package com.list.wildlife.util;

import java.io.OutputStream;


public class Log {
	public static final int NON = 0;
    public static final int BASIC = 1;
    public static final int DEFAULT = 2;
    public static final int DETAIL = 3;

    private static int level = 0;
    private static OutputStream target = System.out;

    public static void setLogType(int level) {
    	Log.level = level;
    }
    
    public static void setTarget(OutputStream os) {
    	Log.target = os;
    }

    public static void log(int level, String s) {
        if(Log.level >= level) {
            try {
            	Log.target.write(s.getBytes());
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static void log(int level, StringBuffer sb) {
    	Log.log(level, sb.toString());
    }
}
